package com.zz.client.handle.defaults;

import com.zz.common.annotation.Executor;
import com.zz.common.config.Constants;
import com.zz.common.entity.Information;
import com.zz.common.enums.MessageType;
import com.zz.common.handle.executor.AbstractMessageExecutor;
import com.zz.common.protocol.DefaultProtocol;
import com.zz.common.tunnel.TunnelHelper;
import com.zz.common.utils.StringUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * 认证处理
 */
@Slf4j
@Executor(msgType = MessageType.C_TYPE_AUTH)
public class AuthFailExecutor extends AbstractMessageExecutor {
    @Override
    public void execute(Information information) {
        switch (information.getProtocolMsg().getHeader()) {
            case Constants.Strings.SUCCESS:
                log.info("认证成功");
                break;
            case Constants.Strings.FAIL:
                log.error(StringUtil.getString(information.getProtocolMsg().getData()));
                TunnelHelper.stop();
                break;
            default:
                log.error("消息异常！请联系管理员处理！");
        }

    }


}
